//home模块小仓库


import {reqCategoryList, reqGetBannerList,reqFloorList} from '@/api/index'

const state = {
    categoryList:[],
    bannerList:[],
    floorList:[]
};
const mutations = {
    SET_CATEGORYLIST(state,data){
        state.categoryList = data;
    },
    SET_BANNERLIST(state,data){
        state.bannerList = data;
    },
    SET_FLOORLIST(state,data){
        state.floorList = data;
    }
};
const actions = {
    categoryList({commit}){
        reqCategoryList().then(res=>{
            if(res.code == 200){
                commit('SET_CATEGORYLIST',res.data)
            }
        })
    },
    //获取首页轮播图数据
    getBannerList({commit}){
        reqGetBannerList().then(res=>{
            commit('SET_BANNERLIST',res.data)
        })
    },
    //获取floor数据
    getFloorList({commit}){
        reqFloorList().then(res=>{
            commit('SET_FLOORLIST',res.data)
        })
    }
};
const getters = {};
export default {
    namespaced: true, // 设置命名空间为 true
    state,
    mutations,
    actions,
    getters
}